{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys,copy,os\n",
    "sys.path.append(os.getcwd()+\"/../neuronVis\")\n",
    "import json\n",
    "\n",
    "import IONData as IONData \n",
    "import BrainRegion as BR \n",
    "\n",
    "import Visual as nv\n",
    "import NeuronProcess\n",
    "import RegionProcess\n",
    "import SwcLoader\n",
    "import GeometryAdapter\n",
    "\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loading nrrd ... \n",
      "loaded only left brain g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/strcture/structure_453.nrrd\n",
      "loading nrrd ... \n",
      "loaded only left brain g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/strcture/structure_500.nrrd\n",
      "[{'sampleid': 'sample', 'name': 'AA0586.swc'}, {'sampleid': 'sample', 'name': 'AA0485.swc'}, {'sampleid': 'sample', 'name': 'AA0451.swc'}, {'sampleid': 'sample', 'name': 'AA0366.swc'}, {'sampleid': 'sample', 'name': 'AA0364.swc'}, {'sampleid': 'sample', 'name': 'AA0350.swc'}, {'sampleid': 'sample', 'name': 'AA0349.swc'}, {'sampleid': 'sample', 'name': 'AA0348.swc'}, {'sampleid': 'sample', 'name': 'AA0347.swc'}, {'sampleid': 'sample', 'name': 'AA0346.swc'}, {'sampleid': 'sample', 'name': 'AA0345.swc'}, {'sampleid': 'sample', 'name': 'AA0343.swc'}, {'sampleid': 'sample', 'name': 'AA0340.swc'}, {'sampleid': 'sample', 'name': 'AA0339.swc'}, {'sampleid': 'sample', 'name': 'AA0338.swc'}, {'sampleid': 'sample', 'name': 'AA0337.swc'}, {'sampleid': 'sample', 'name': 'AA0331.swc'}, {'sampleid': 'sample', 'name': 'AA0302.swc'}]\n"
     ]
    }
   ],
   "source": [
    "br = BR.BrainRegion()\n",
    "br.praseJson()\n",
    "SSbr= br.getRegion('SS')\n",
    "MObr= br.getRegion('MO')\n",
    "mergebr= RegionProcess.mergeRegion(SSbr,MObr)\n",
    "# get neuron list\n",
    "f=open('../resource/paper1figure7list.json', encoding='gbk')\n",
    "paper1figure7list=[]\n",
    "paper1figure7list = json.load(f)\n",
    "print(paper1figure7list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0586.swc\n",
      "maxindex: 5524\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0485.swc\n",
      "maxindex: 1872\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0451.swc\n",
      "maxindex: 5796\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0366.swc\n",
      "maxindex: 4498\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0364.swc\n",
      "maxindex: 3656\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0350.swc\n",
      "maxindex: 4791\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0349.swc\n",
      "maxindex: 4543\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0348.swc\n",
      "maxindex: 4131\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0347.swc\n",
      "maxindex: 4984\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0346.swc\n",
      "maxindex: 6633\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0345.swc\n",
      "maxindex: 3937\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0343.swc\n",
      "maxindex: 4545\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0340.swc\n",
      "maxindex: 4218\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0339.swc\n",
      "maxindex: 4650\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0338.swc\n",
      "maxindex: 4254\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0337.swc\n",
      "maxindex: 4030\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0331.swc\n",
      "maxindex: 4332\n",
      "exist  g:\\workspace\\neuron-vis\\figures/../neuronVis/../resource/swc/sample/AA0302.swc\n",
      "maxindex: 2160\n"
     ]
    }
   ],
   "source": [
    "iondata=IONData.IONData()\n",
    "centroidList=[]\n",
    "for neuron in paper1figure7list:\n",
    "    swc = iondata.getNeuronByID(neuron['sampleid'], neuron['name'])\n",
    "    neuronTree = SwcLoader.NeuronTree()\n",
    "    neuronTree.readSWC(swc)\n",
    "    centroid = NeuronProcess.getCentroid(neuronTree,mergebr)\n",
    "    centroidList.append([np.array(neuronTree.root.xyz),centroid])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[3386.06417221 2738.3677587  3892.3201525 ]\n",
      "[3842.74265727 2790.78667707 3232.01223584]\n",
      "[3446.49255479 2679.21878629 3498.49162945]\n",
      "[3238.31762077 2541.271877   3678.2660034 ]\n",
      "[4471.08564876 3378.25462236 2554.78540414]\n",
      "[3313.94828504 2736.54001162 3683.33569337]\n",
      "[4495.41950121 3355.0416571  2332.1261084 ]\n",
      "[3653.79948546 3127.26763749 2802.90121839]\n",
      "[4123.91871452 2299.66264883 3598.0748131 ]\n",
      "[3103.42179165 2424.23905711 4027.75604016]\n",
      "[3840.42016232 2647.07891598 3187.8105466 ]\n",
      "[4414.55507984 3292.16453472 2280.65145905]\n",
      "[3377.81749744 2892.24641026 3118.3384    ]\n",
      "[4036.19643657 3146.66303703 2601.65713836]\n",
      "[3945.46743639 2638.37758105 3164.36809209]\n",
      "[3568.09814079 2810.03622356 3604.16196056]\n",
      "[3714.37396172 2077.0718671  3799.53440564]\n",
      "[3968.53522845 2497.96083694 3521.3148905 ]\n"
     ]
    }
   ],
   "source": [
    "point=RegionProcess.getIntersectionFacePoints(SSbr,MObr)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[array([6814.8477, 4458.618 , 4711.323 ], dtype=float32), array([3386.06417221, 2738.3677587 , 3892.3201525 ])]\n",
      "[array([6814.8477, 4458.618 , 4711.323 ], dtype=float32), array([3386.06417221, 2738.3677587 , 3892.3201525 ]), array([1287.49327506,    0.        ,    0.        ])]\n",
      "[array([6736.87  , 4406.8804, 4542.037 ], dtype=float32), array([3842.74265727, 2790.78667707, 3232.01223584])]\n",
      "[array([6736.87  , 4406.8804, 4542.037 ], dtype=float32), array([3842.74265727, 2790.78667707, 3232.01223584]), array([499.79244051,   0.        ,   0.        ])]\n",
      "[array([6791.2236, 4667.1494, 4802.8584], dtype=float32), array([3446.49255479, 2679.21878629, 3498.49162945])]\n",
      "[array([6791.2236, 4667.1494, 4802.8584], dtype=float32), array([3446.49255479, 2679.21878629, 3498.49162945]), array([981.68573468,   0.        ,   0.        ])]\n",
      "[array([6725.3154, 4492.541 , 4902.9453], dtype=float32), array([3238.31762077, 2541.271877  , 3678.2660034 ])]\n",
      "[array([6725.3154, 4492.541 , 4902.9453], dtype=float32), array([3238.31762077, 2541.271877  , 3678.2660034 ]), array([1281.61365538,    0.        ,    0.        ])]\n",
      "[array([6765.898 , 4201.9863, 4898.115 ], dtype=float32), array([4471.08564876, 3378.25462236, 2554.78540414])]\n",
      "[array([6765.898 , 4201.9863, 4898.115 ], dtype=float32), array([4471.08564876, 3378.25462236, 2554.78540414]), array([366.18368128,   0.        ,   0.        ])]\n",
      "[array([6635.955 , 4360.2734, 4835.3516], dtype=float32), array([3313.94828504, 2736.54001162, 3683.33569337])]\n",
      "[array([6635.955 , 4360.2734, 4835.3516], dtype=float32), array([3313.94828504, 2736.54001162, 3683.33569337]), array([1193.68271059,    0.        ,    0.        ])]\n",
      "[array([6850.741 , 4264.5947, 4545.409 ], dtype=float32), array([4495.41950121, 3355.0416571 , 2332.1261084 ])]\n",
      "[array([6850.741 , 4264.5947, 4545.409 ], dtype=float32), array([4495.41950121, 3355.0416571 , 2332.1261084 ]), array([541.94929159,   0.        ,   0.        ])]\n",
      "[array([6905.4854, 4454.8496, 4759.6255], dtype=float32), array([3653.79948546, 3127.26763749, 2802.90121839])]\n",
      "[array([6905.4854, 4454.8496, 4759.6255], dtype=float32), array([3653.79948546, 3127.26763749, 2802.90121839]), array([320.19856626,   0.        ,   0.        ])]\n",
      "[array([6563.5557, 4073.6533, 4279.2246], dtype=float32), array([4123.91871452, 2299.66264883, 3598.0748131 ])]\n",
      "[array([6563.5557, 4073.6533, 4279.2246], dtype=float32), array([4123.91871452, 2299.66264883, 3598.0748131 ]), array([570.5870386,   0.       ,   0.       ])]\n",
      "[array([6608.3354, 4259.8105, 4762.896 ], dtype=float32), array([3103.42179165, 2424.23905711, 4027.75604016])]\n",
      "[array([6608.3354, 4259.8105, 4762.896 ], dtype=float32), array([3103.42179165, 2424.23905711, 4027.75604016]), array([1643.37029544,    0.        ,    0.        ])]\n",
      "[array([6684.5234, 4307.1157, 4774.466 ], dtype=float32), array([3840.42016232, 2647.07891598, 3187.8105466 ])]\n",
      "[array([6684.5234, 4307.1157, 4774.466 ], dtype=float32), array([3840.42016232, 2647.07891598, 3187.8105466 ]), array([525.45375167,   0.        ,   0.        ])]\n",
      "[array([6778.412 , 4216.5483, 4592.093 ], dtype=float32), array([4414.55507984, 3292.16453472, 2280.65145905])]\n",
      "[array([6778.412 , 4216.5483, 4592.093 ], dtype=float32), array([4414.55507984, 3292.16453472, 2280.65145905]), array([523.355328,   0.      ,   0.      ])]\n",
      "[array([6741.2646, 4228.4336, 4492.215 ], dtype=float32), array([3377.81749744, 2892.24641026, 3118.3384    ])]\n",
      "[array([6741.2646, 4228.4336, 4492.215 ], dtype=float32), array([3377.81749744, 2892.24641026, 3118.3384    ]), array([743.61286904,   0.        ,   0.        ])]\n",
      "[array([6925.4087, 4414.4014, 4595.4497], dtype=float32), array([4036.19643657, 3146.66303703, 2601.65713836])]\n",
      "[array([6925.4087, 4414.4014, 4595.4497], dtype=float32), array([4036.19643657, 3146.66303703, 2601.65713836]), array([59.07932932,  0.        ,  0.        ])]\n",
      "[array([6692.516 , 4079.1455, 4478.2183], dtype=float32), array([3945.46743639, 2638.37758105, 3164.36809209])]\n",
      "[array([6692.516 , 4079.1455, 4478.2183], dtype=float32), array([3945.46743639, 2638.37758105, 3164.36809209]), array([443.91065036,   0.        ,   0.        ])]\n",
      "[array([6691.0146, 4149.206 , 4778.012 ], dtype=float32), array([3568.09814079, 2810.03622356, 3604.16196056])]\n",
      "[array([6691.0146, 4149.206 , 4778.012 ], dtype=float32), array([3568.09814079, 2810.03622356, 3604.16196056]), array([950.38808254,   0.        ,   0.        ])]\n",
      "[array([6758.3794, 4633.777 , 4443.564 ], dtype=float32), array([3714.37396172, 2077.0718671 , 3799.53440564])]\n",
      "[array([6758.3794, 4633.777 , 4443.564 ], dtype=float32), array([3714.37396172, 2077.0718671 , 3799.53440564]), array([1052.17981162,    0.        ,    0.        ])]\n",
      "[array([6598.2407, 4150.415 , 4584.439 ], dtype=float32), array([3968.53522845, 2497.96083694, 3521.3148905 ])]\n",
      "[array([6598.2407, 4150.415 , 4584.439 ], dtype=float32), array([3968.53522845, 2497.96083694, 3521.3148905 ]), array([676.25761662,   0.        ,   0.        ])]\n"
     ]
    }
   ],
   "source": [
    "centroidListtemp=copy.deepcopy(centroidList)\n",
    "for centroid in centroidListtemp:\n",
    "    print(centroid)\n",
    "    mindist=10000\n",
    "    \n",
    "    for p in point:\n",
    "        dist= np.sqrt(np.sum(np.square(np.array(centroid[1])-p)))\n",
    "        mindist =dist if dist<mindist else mindist\n",
    "    centroid.append(np.array([mindist,0,0]))\n",
    "    print(centroid)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[6.68867676 6.85796289 6.5971416  6.49705469 6.50188477 6.56464844\n",
      " 6.85459082 6.64037451 7.12077539 6.637104   6.62553418 6.80790723\n",
      " 6.90778516 6.80455029 6.92178174 6.62198779 6.95643604 6.81556104] [1.28749328 0.49979244 0.98168573 1.28161366 0.36618368 1.19368271\n",
      " 0.54194929 0.32019857 0.57058704 1.6433703  0.52545375 0.52335533\n",
      " 0.74361287 0.05907933 0.44391065 0.95038808 1.05217981 0.67625762]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "d:\\ProgramData\\Anaconda3\\envs\\neuronVis\\lib\\site-packages\\IPython\\core\\pylabtools.py:151: UserWarning: Glyph 25955 (\\N{CJK UNIFIED IDEOGRAPH-6563}) missing from current font.\n",
      "  fig.canvas.print_figure(bytes_io, **kw)\n",
      "d:\\ProgramData\\Anaconda3\\envs\\neuronVis\\lib\\site-packages\\IPython\\core\\pylabtools.py:151: UserWarning: Glyph 28857 (\\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from current font.\n",
      "  fig.canvas.print_figure(bytes_io, **kw)\n",
      "d:\\ProgramData\\Anaconda3\\envs\\neuronVis\\lib\\site-packages\\IPython\\core\\pylabtools.py:151: UserWarning: Glyph 22270 (\\N{CJK UNIFIED IDEOGRAPH-56FE}) missing from current font.\n",
      "  fig.canvas.print_figure(bytes_io, **kw)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAATEAAAEWCAYAAAAOzKDmAAAAOXRFWH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5WagKuBwyXNzC/fDgHuKbmmkXGhI/L6CtViTffn28nHnhZQUGi0+HepOz8DAXg/sDoiniiiniYmGqdcCZya36U8FHg8In5VYj3Fm4o7F1P1i+wyYxC4g+xScU/gg8AH8/0fBu4iG89YA/xJ2TXlx/SR/UdyJ3B2RWo6DfhWhf7dzQWuIxsPuxN4T8n1vBG4F9gALAf2nKLvaRey//HuMWrb6LpE1tviZ/l31VtyPS8mO7N9AtiSv969kzX4sSMzS1ptLifNbHpyiJlZ0hxiZpY0h5iZJc0hZmZJc4jZlJA0X9KdbRx/mqS5o96fnc+jMxvDIWZVdRrZ3LARZwNthZikGR2sxyrKIWZTaaakb+Trc10p6QWSzpN0a75u2bJ8pvmJQC/wjXydqo+QBdqNkm4EkPSWfJ2q2yR9R9Ku+fZfSLpQ0m3Aufk/yfftO/q91YNDzKbSAuDiiHgV2QzuvwIuiojXR8RrgC7gbRFxJdls+XdHxEER8Xmy1SuOioij8uddPw4cExEH58eeM+rnPBIRB0fEZ4DHJR2Ubz8d+OoU/DltCjnEbCo9EBE35a//HTgcOErSLZLWA28GWlke6VCy9bxuyleReB9jO0T/x6jXlwKn55eW7wK+uWN/BKuaQpvnmjVofMYtgIvJnu97QNKngJ1b+BwBP4yIk8fZ/+So11cBnyRbwHBtRBT2wL+Vw2diNpXm6Zm16k8B/jt//XA+pnXiqGN/A+w2zvs1wGGSXgEgaZfx1mCLrMv8AHAJvpSsJYeYTaUNwIck3UO2KsQlwL+RrUoxANw66tjLgC/lA/tdZI1YfyDpxojYTHb38gpJdwA3M/HaYt8AniZbBcNqxqtYWO3lXXb2iIhPlF2LdZ7HxKzWJH0XeDnZTQOrIZ+JmVnSPCZmZklziJlZ0hxiZpY0h5iZJc0hZmZJ+3/BQL8BRt0p/gAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 720x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "temp =np.array(centroidListtemp)\n",
    "x=11.4-temp[:,0,2]/1000\n",
    "y=temp[:,2,0]/1000\n",
    "print(x,y)\n",
    "\n",
    "# print(x)\n",
    "# 画出数据的散点图\n",
    "fig = plt.figure()\n",
    "fig.set_size_inches(10, 4)   # 整个绘图区域的宽度10和高度4\n",
    "ax = fig.add_subplot(1, 2, 1)  # 整个绘图区分成一行两列，当前图是第一个。\n",
    "# 画出原始数据的散点图。\n",
    "ax.set_title(\"散点图\")\n",
    "ax.set_xlabel(\"battery\")\n",
    "ax.set_ylabel(\"KM\")\n",
    "ax.scatter(x, y)\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "4d5dabf3f589416eb72cea1a29371e94",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "RFBOutputContext()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "\n",
    "\n",
    "# render\n",
    "neuronvis = nv.neuronVis()\n",
    "# neuronvis.addNeuronByList(paper1figure7list)\n",
    "neuronvis.render.setLookAt((-10000,-10000,-10000),(0,0,0),(0,1,0))\n",
    "neuronvis.render\n",
    "\n",
    "ga = GeometryAdapter.GeometryAdapter()\n",
    "index=0\n",
    "for p in centroidList:\n",
    "\tga.geometry.addPoint(p.tolist())\n",
    "\tga.geometry.addIndex(index)\n",
    "\tindex=index+1\n",
    "ga.geometry.drawModel='points'\n",
    "neuronvis.render.addGeometry(ga.geometry)\n",
    "neuronvis.render\n",
    "\n",
    "# neuronvis.render.savepng('../resource/test3.png')\n",
    "nv.app.run()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "neuronVis",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3 (default, Jul  2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "e1da01a652087c3f485a2a8b69806c32fa3b3acf94bcdc0c1ef74e2af5cc794e"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
